package com.qf.aspects;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

//@Component
//@Aspect
public class OrderServiceAspect {

    @Pointcut("execution(* com.qf.service..*.findById(Integer))")
    public void pt(){}

    @Before("pt()")
    public void before(JoinPoint jp){
        Object[] args = jp.getArgs();
        Integer uid = (Integer) args[0];

        if (uid > 100){
            throw new RuntimeException("该用户id不在数据库范围...");
        }
    }
}
